<!--
 * @Description: 活动 - 疯狂星期五商品审核
 * @Author: liyujie
 * @Date: 2021/05/28
 * @Last Modified by: liyujie
 * @Last Modified time: 2021/05/28
-->
<template>
    <div class="wrapper">
        <div class="content-wrapper">
            <!-- header -->
            <div class="header">
                <div class="header-title">
                    疯狂星期五
                </div>
                <div class="add-btn">
                    <el-button
                        type="primary"
                        size="medium"
                        icon="el-icon-setting"
                        @click="handleRoute('crazyFridaySetting')"
                    >
                        活动设置
                    </el-button>
                    <el-button
                        type="primary"
                        size="medium"
                        icon="el-icon-plus"
                        @click="handleRoute('crazyFridayGoodsAdd')"
                    >
                        添加商品
                    </el-button>
                </div>
            </div>
            <!-- /header -->
            <!-- 筛选-->
            <div class="filter-view">
                <div class="header-new-box">
                    <el-radio-group
                        v-model="filterData.verify"
                        size="small"
                        @change="getTableData(1)"
                    >
                        <el-radio-button
                            v-for="item in statusList"
                            :key="item.value"
                            :label="item.value"
                        >
                            {{ item.label }}
                        </el-radio-button>
                    </el-radio-group>
                </div>
                <div class="header-new-box">
                    <p class="header-new-box-title">
                        商品信息
                    </p>
                    <el-input
                        placeholder="搜索商品编号，商品名称"
                        v-model="filterData.keyword"
                        suffix-icon="el-icon-search"
                        clearable
                        size="small"
                        style="width: 240px"
                        @keydown.enter.native="getTableData(1)"
                    />
                </div>
                <div class="header-new-box">
                    <p class="header-new-box-title">
                        店铺名称
                    </p>
                    <el-input
                        placeholder="搜索店铺名称"
                        v-model="filterData.shop_title"
                        suffix-icon="el-icon-search"
                        clearable
                        size="small"
                        style="width: 240px"
                        @keydown.enter.native="getTableData(1)"
                    />
                </div>

                <div class="header-new-box">
                    <el-button
                        type="primary"
                        size="small"
                        @click="getTableData(1)"
                    >
                        查询
                    </el-button>
                    <el-button
                        type="primary"
                        size="small"
                        @click="handleExport()"
                    >
                        导出商品
                    </el-button>
                </div>
            </div>
            <!--筛选-->

            <!-- table -->
            <div class="table-wrapper">
                <el-table
                    :data="tableData"
                    height="100%"
                    style="width: 100%;"
                    ref="table"
                    class="data-table"
                    v-loading="tableLoading"
                    row-key="sale_no"
                    :cell-style="{height: '140px'}"
                    @selection-change="handleSelectedChange"
                >
                    <el-table-column
                        align="center"
                        width="50"
                        type="selection"
                        fixed="left"
                        reserve-selection
                    />
                    <el-table-column
                        width="340"
                        label="商品信息"
                        fixed="left"
                    >
                        <template slot-scope="scope">
                            <div class="goods-info">
                                <img
                                    :src="scope.row.goods_cover"
                                    class="goods-cover"
                                    @click="fnShowPreview(scope.row.goods_cover)"
                                >
                                <div class="info">
                                    <div class="goods-info__title">
                                        {{ scope.row.goods_title }}
                                    </div>
                                    <div class="goods-info__no">
                                        商品编号：{{ scope.row.goods_no }}
                                    </div>
                                    <div class="goods-info__shop-title">
                                        店铺名称：{{ scope.row.shop_title }}
                                    </div>
                                </div>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="活动价（元）"
                        show-overflow-tooltip
                        align="center"
                        width="120"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.min_activity_price }}起
                            <el-button
                                type="text"
                                @click="showPriceDialog(scope.row)"
                            >
                                查看
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="原售价（元）"
                        show-overflow-tooltip
                        align="center"
                        width="120"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.min_product_price }}起
                            <el-button
                                type="text"
                                @click="showPriceDialog(scope.row)"
                            >
                                查看
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="commission_rate"
                        label="佣金比例（%）"
                        show-overflow-tooltip
                        align="center"
                        width="120"
                        :formatter="emptyFormatter"
                    />
                    <el-table-column
                        label="商家总库存"
                        show-overflow-tooltip
                        align="center"
                        width="110"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.total_stock }}
                            <el-button
                                type="text"
                                @click="showPriceDialog(scope.row)"
                            >
                                查看
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="cate_type_name"
                        label="商品组"
                        show-overflow-tooltip
                        width="140"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.goods_cate_name_list.length > 0 ? scope.row.goods_cate_name_list.join() : '--' }}
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="报名来源"
                        show-overflow-tooltip
                        align="center"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.from_type === 1 ? '平台报名' : '商家报名' }}
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="sale_num"
                        width="120"
                        :render-header="(h, title, content) => renderHeader(h, '活动销量', '活动销量是指该商品在每周活动期间的销量（如果活动商品是部分SKU参加活动，活动销量包含未报名参加活动的SKU的销量）。用户提交订单，活动销量就会增加，取消订单和仅退款，退货退款，活动销量不会减少。')"
                        show-overflow-tooltip
                        align="center"
                    />
                    <el-table-column
                        label="创建时间"
                        align="left"
                        :formatter="emptyFormatter"
                        min-width="160"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.create_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm:ss') }}
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="buy_limit_count"
                        label="限购数量"
                        show-overflow-tooltip
                        align="center"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.buy_limit_count === -1 ? '不限' : '' }}
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="活动时间"
                        align="left"
                        :formatter="emptyFormatter"
                        min-width="180"
                    >
                        <template slot-scope="scope">
                            {{ scope.row.activity_start_time * 1000 | dateFormatter('yyyy/MM/dd') }} - {{ scope.row.activity_end_time * 1000 | dateFormatter('yyyy/MM/dd') }}
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="历史参与活动次数"
                        align="center"
                        :formatter="emptyFormatter"
                        width="140"
                    >
                        <template slot-scope="scope">
                            <span>{{ scope.row.goods_join_count }}</span>
                            <el-button
                                type="text"
                                @click="getHistoryList(scope.row)"
                            >
                                查看
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="审核状态"
                        width="150"
                        align="center"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            <div class="status-wrapper">
                                <div
                                    :class="['status-dot', scope.row.verify === 0 ? 'warning' : scope.row.verify === -1 ? 'danger' : scope.row.verify === 1 ? 'success' : 'normal']"/>
                                {{ scope.row.verify | verifyStatusFilter }}
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="活动状态"
                        align="center"
                        :formatter="emptyFormatter"
                    >
                        <template slot-scope="scope">
                            <div class="status-wrapper">
                                <div
                                    :class="['status-dot', scope.row.status === 0 ? 'danger' : scope.row.status === 1 ? 'success' : 'normal']"/>
                                {{ scope.row.status | statusFilter }}
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        label="操作"
                        align="left"
                        width="210"
                        fixed="right"
                    >
                        <template slot-scope="scope">
                            <div class="option-btn-group">
                                <el-button
                                    type="text"
                                    :disabled="scope.row.verify === 1 || scope.row.verify === -2"
                                    @click="showPassDialog(scope.row)"
                                >
                                    通过
                                </el-button>
                                <el-button
                                    type="text"
                                    :disabled="scope.row.verify === -1 || scope.row.verify === -2"
                                    @click="showRejectDialog(scope.row)"
                                >
                                    不通过
                                </el-button>
                                <el-button
                                    type="text"
                                    @click="handleRoute('crazyFridayGoodsEdit', {sale_no: scope.row.sale_no, type: 'detail'})"
                                >
                                    查看
                                </el-button>
                                <el-button
                                    type="text"
                                    @click="handleRoute('crazyFridayGoodsEdit', {sale_no: scope.row.sale_no, type: 'edit'})"
                                >
                                    编辑
                                </el-button>
                                <el-button
                                    type="text"
                                    :disabled="scope.row.verify !== 1 && scope.row.verify !== 0"
                                    @click="showGoodsGroup(scope.row)"
                                >
                                    分配商品组
                                </el-button>
                                <el-button
                                    type="text"
                                    v-if="scope.row.verify === -1"
                                    @click="showRejectDialog(scope.row, 1)"
                                >
                                    驳回原因
                                </el-button>
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <!-- /table -->

            <!-- /分页 -->
            <div class="pagination-wrapper clearfix">
                <div class="op-view">
                    <el-checkbox
                        label="当页全选"
                        v-model="checkAllStatus"
                        :indeterminate="checkIndeterminate"
                        :disabled="tableData.length === 0"
                        @change="handleSelectedAll"
                    />
                    <el-button
                        type="text"
                        size="medium"
                        style="margin-left: 12px"
                        :disabled="multipleSelection.length === 0"
                        @click="showVerifyBatchDialog(1)"
                    >
                        批量通过
                    </el-button>
                    <el-button
                        type="text"
                        size="medium"
                        style="margin-left: 12px"
                        :disabled="multipleSelection.length === 0"
                        @click="showVerifyBatchDialog(-1)"
                    >
                        批量驳回
                    </el-button>
                    <el-pagination
                        layout="total, prev, pager, next, jumper"
                        background
                        :current-page.sync="page.now_page"
                        :total="page.total_count"
                        :page-size="page.page_size"
                        @current-change="getTableData"
                    />
                </div>
            </div>
        </div>

        <!-- 查看价格弹窗 -->
        <el-dialog
            title="查看商品"
            :visible.sync="productVisible"
            width="800px"
            :close-on-click-modal="false"
        >
            <el-table
                :data="detailRow.product_list"
                height="100%"
                style="width: 100%;max-height: 450px"
                class="data-table"
            >
                <el-table-column
                    prop="spec_list"
                    label="规格名称"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                >
                    <template slot-scope="scope">
                        {{ scope.row.goods_specs | filterSpec }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="price"
                    label="活动价(元)"
                    show-overflow-tooltip
                    align="center"
                    :formatter="emptyFormatter"
                />
                <el-table-column
                    prop="product_price"
                    label="原售价(元)"
                    show-overflow-tooltip
                    align="center"
                    :formatter="emptyFormatter"
                />
                <el-table-column
                    prop="product_stock"
                    label="实际库存"
                    show-overflow-tooltip
                    align="center"
                />
            </el-table>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    @click="productVisible = false"
                    size="medium"
                    type="primary"
                >
                    我知道了
                </el-button>
            </span>
        </el-dialog>
        <!--历史参与活动次数弹窗-->
        <el-dialog
            title="历史参与活动次数"
            :visible.sync="historyDialog"
            width="680px"
            :close-on-click-modal="false"
        >
            <el-table
                :data="historyList"
                height="100%"
                style="width: 100%;max-height: 450px"
                class="data-table"
            >
                <el-table-column
                    label="往期活动时间"
                    show-overflow-tooltip
                >
                    <template slot-scope="scope">
                        {{ scope.row.activity_start_time * 1000 | dateFormatter('yyyy/MM/dd') }} - {{ scope.row.activity_end_time * 1000 | dateFormatter('yyyy/MM/dd') }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="price"
                    label="活动价(元)"
                    show-overflow-tooltip
                    align="center"
                    :formatter="emptyFormatter"
                >
                    <template slot-scope="scope">
                        ￥{{ scope.row.min_activity_price }}起
                        <el-popover
                            placement="bottom"
                            width="540"
                            trigger="click"
                            style="margin-left: 10px"
                            popper-class="friday-goods-verify-history-list"
                        >
                            <el-table :data="scope.row.product_list">
                                <el-table-column
                                    label="商品规格"
                                    show-overflow-tooltip
                                >
                                    <template slot-scope="scope">
                                        {{ scope.row.goods_specs | filterSpec }}
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    label="活动价"
                                    align="center"
                                    show-overflow-tooltip
                                >
                                    <template slot-scope="scope">
                                        ￥{{ scope.row.price }}
                                    </template>
                                </el-table-column>
                            </el-table>
                            <el-button
                                slot="reference"
                                type="text"
                            >
                                查看
                            </el-button>
                        </el-popover>
                    </template>
                </el-table-column>
            </el-table>
            <div
                class="pagination-wrapper"
                style="margin-top: 24px; display: flex; justify-content: flex-end"
            >
                <el-pagination
                    layout="total, prev, pager, next, jumper"
                    background
                    :current-page.sync="dialogPage.now_page"
                    :total="dialogPage.total_count"
                    :page-size="dialogPage.page_size"
                    @current-change="getHistoryList"
                />
            </div>
        </el-dialog>
        <!-- 驳回弹窗 -->
        <reject-dialog
            ref="rejectDialog"
            :visible.sync="rejectDialog"
            :reason-detail="reasonDetail"
            :maxlength="100"
            @confirm="handleExamine(sale_no,-1, $event)"
        />
        <!-- 批量驳回弹窗 -->
        <reject-dialog
            ref="rejectBatchDialog"
            :visible.sync="rejectBatchDialog"
            :maxlength="100"
            @confirm="handleBatchVerify(sale_nos,-1, $event)"
        />
        <!-- /驳回弹窗 -->
        <!-- 图片预览 -->
        <img-preview
            ref="preview"
        />
        <!-- 设置商品组 -->
        <shop-group
            ref="shopGroup"
            @sendData="setGoodsGroup"
        />
    </div>
</template>

<script>
import { back } from '@/mixin/back';
import ImgPreview from "@/components/common/img-preview";
import RejectDialog from "@/components/dialog/reject-dialog";
import GoodsTypeSelect from "@/components/goods/goods-type-select";
import ShopGroup from "@/components/student/shop-group";

export default {
    name: 'CrazyFridayGoodsVerify',
    mixins: [back],
    components: {ShopGroup, GoodsTypeSelect, RejectDialog, ImgPreview},
    data() {
        return {
            filterData: {
                verify: 99,
                // 活动信息
                keyword: '',
                shop_title: '',
                week: ''
            },
            tableData: [],
            tableLoading: false,
            page: {
                now_page: 1,
                total_count: 0,
                page_size: 20
            },
            statusList: [
                {label: '全部', value: 99},
                {label: '待审核', value: 0},
                {label: '审核通过', value: 1},
                {label: '审核不通过', value: -1},
                {label: '取消报名', value: -2},
            ],
            // 价格弹窗
            productVisible: false,
            detailRow: {},
            sale_no: '',
            sale_nos: '',
            rejectBatchDialog: false,
            rejectDialog: false,
            reasonDetail: '',
            checkAllStatus: false,
            checkIndeterminate: false,
            multipleSelection: [],
            goods_nos: [],
            // 活动历史数据
            historyDialog: false,
            historyList: [],
            dialogPage: {
                now_page: 1,
                total_count: 0,
                page_size: 5
            },
        };
    },
    computed: {},
    watch: {},
    filters: {
        verifyStatusFilter(val) {
            switch (val) {
                case 0:
                    return '待审核';
                case 1:
                    return '已通过';
                case -1:
                    return '未通过';
                case -2:
                    return '取消报名';
                default:
                    return '--';
            }
        },
        statusFilter(val) {
            switch (val) {
                case 0:
                    return '未开始';
                case 1:
                    return '进行中';
                case 2:
                    return '已结束';
                case -1:
                    return '未生效';
                default:
                    return '--';
            }
        },
        filterSpec (val) {
            if(!val) return '';
            let str = '';

            val.forEach(el => {
                str += el.spec_name + ':' + el.spec_value + ';';
            });
            return str;
        }
    },
    mounted() {
        this.$store.commit('SET_HEADER', [{title: "APP后台"}, {title: '商城'}, {title: '活动管理'}, {title: '疯狂星期五'}, {title: '商品审核'}]);
        this.authResult = this.$route.meta.authResult;
        this.getTableData();
    },

    methods: {

        /**
         * @description 获取列表数据
         * @param page
         */
        getTableData(page) {
            this.tableLoading = true;
            let params = { ...this.filterData };

            params.page_id = page || this.page.now_page;
            this.$post('/student/shop_goods_activity_friday_sale%5Cget_list', params, res => {
                if (res.code === 1) {
                    this.tableData = res.data.list;
                    this.page = res.data.page;
                } else {
                    this.$notify({
                        title: '提示',
                        message: res.msg,
                        type: 'warning'
                    });
                }
                this.tableLoading = false;
            });
        },

        /**
         * 路由跳转
         * @param routeName
         * @param query
         */
        handleRoute(routeName, query) {
            this.$router.push({
                name: routeName,
                query
            });
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        },

        /**
         * 预览图片
         * @param   {String}    images      //单图预览
         * @param   {Array}     images      //多图预览
         * @param index
         */
        fnShowPreview(images, index) {
            if (images && Object.prototype.toString.call(images) == '[object String]') {
                this.$refs.preview.show([
                    images
                ]);
            } else if (images && Object.prototype.toString.call(images) == '[object Array]') {
                this.$refs.preview.show(images, index);
            } else {
                this.$message({
                    type: 'warning',
                    message: '图片类型错误'
                });
            }
        },

        /**
         * 显示详细价格弹窗
         * @param row
         */
        showPriceDialog(row) {
            this.detailRow = row;
            this.productVisible = true;
        },

        /**
         * 审核通过提示弹窗
         * @param row
         */
        showPassDialog(row) {
            if(!this.authResult.auth_verify) {
                this.$notify({
                    title: '提示',
                    message: '请联系管理员添加权限',
                    type: 'warning',
                    duration: 2000
                });
                return false;
            }
            this.$confirm('是否确认通过审核?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.handleExamine(row.sale_no, 1);
            });
        },

        /**
         * 驳回弹窗
         * @param type - 0填写驳回原因  1回显原因
         * @param row
         */
        showRejectDialog(row, type = 0) {
            if(type === 1) {
                // 回显
                this.reasonDetail = row.verify_fail_reason;
                this.rejectDialog = true;
            } else {
                if(!this.authResult.auth_verify) {
                    this.$notify({
                        title: '提示',
                        message: '请联系管理员添加权限',
                        type: 'warning',
                        duration: 2000
                    });
                    return false;
                }
                // 填写
                this.sale_no = row.sale_no;
                this.$refs.rejectDialog.title = '审核驳回';
                this.reasonDetail = '';
                this.rejectDialog = true;
            }
        },

        /**
         * 审核
         * @param verify - 1通过  -1拒绝
         * @param verify_fail_reason - 拒绝原因
         * @param sale_no - 编号
         */
        handleExamine(sale_no, verify, verify_fail_reason = '') {
            let params = {
                sale_no,
                verify_fail_reason,
                verify
            };

            this.$post('/student/shop_goods_activity_friday_sale%5Caudit', params, resp => {
                if (resp.code === 1) {
                    this.rejectDialog = false;
                    this.getTableData();
                    this.$notify({
                        title: '成功',
                        message: '操作成功',
                        duration: 2000,
                        type: 'success'
                    });
                } else {
                    this.$notify({
                        title: '提示',
                        message: resp.msg,
                        duration: 2000,
                        type: 'warning'
                    });
                }
            });
        },

        /**
         * 点击全选
         * @param val
         */
        handleSelectedAll(val) {
            if(val) {
                this.$refs.table.toggleAllSelection();
            } else {
                this.$refs.table.clearSelection();
            }
            this.checkIndeterminate = false;
        },

        /**
         * 批量审核通过或者拒绝
         * @param verify - 1通过 -1拒绝
         */
        showVerifyBatchDialog(verify) {
            this.sale_nos = this.multipleSelection.map(item => {
                return item.sale_no;
            }).join();
            if(verify === 1) {
                this.$confirm('是否确认通过审核?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.handleBatchVerify(this.sale_nos, 1);
                }).catch(() => {});
            } else {
                this.rejectBatchDialog = true;
            }
        },


        /**
         * 批量审核
         * @param verify - 1通过  -1拒绝
         * @param verify_fail_reason - 拒绝原因
         * @param sale_nos - 编号
         */
        handleBatchVerify(sale_nos, verify, verify_fail_reason = '') {
            let params = {
                sale_nos,
                verify,
                verify_fail_reason
            };

            this.$post('/student/shop_goods_activity_friday_sale%5Caudit_batch', params, resp => {
                if (resp.code === 1) {
                    this.getTableData();
                    this.$refs.table.clearSelection();
                    this.$notify({
                        title: '成功',
                        message: '操作成功',
                        duration: 2000,
                        type: 'success'
                    });
                } else {
                    this.$notify({
                        title: '提示',
                        message: resp.msg,
                        duration: 2000,
                        type: 'warning'
                    });
                }
            });
        },

        /**
         * 选中
         * @param selection
         */
        handleSelectedChange(selection) {
            let checkedCount = selection.length;

            this.multipleSelection = selection;
            this.checkAllStatus = checkedCount === this.tableData.length;
            this.checkIndeterminate = checkedCount > 0 && checkedCount < this.tableData.length;
        },

        /**
         * 显示商品组弹窗
         * @param row
         */
        showGoodsGroup(row) {
            this.$post('/student/shop_goods%5Ccurrent_cate', {
                goods_no: row.goods_no
            }, resp => {
                if (resp.code === 1) {
                    this.goods_nos = [row.goods_no];
                    if(Object.prototype.toString.call(resp.data) !== '[object Null]' && resp.data.list.length > 0) {
                        this.$refs.shopGroup.getType('edit', {
                            data: resp.data,
                            goods_no: row.goods_no
                        });
                        this.$refs.shopGroup.show();
                    } else {
                        this.$refs.shopGroup.show();
                        this.$refs.shopGroup.getType('add');
                        this.$refs.shopGroup.getNext(true);
                        return false;
                    }
                } else {
                    this.$notify({
                        title: '提示',
                        type: 'warning',
                        message: resp.msg
                    });
                }
            });
        },

        /**
         * 分配商品组
         * @param val
         */
        setGoodsGroup(val) {
            this.$post('/student/shop_goods%5Cjoin_cate', {
                goods_nos: this.goods_nos.join(),
                data_nos: val.data.join()
            }, resp => {
                if (resp.code === 1) {
                    this.$refs.shopGroup.hide();
                    this.getTableData();
                    this.$notify({
                        title: '提示',
                        type: 'success',
                        message: '操作成功'
                    });
                } else {
                    this.$notify({
                        title: '提示',
                        type: 'warning',
                        message: resp.msg
                    });
                }
            });
        },

        /**
         * 自定义表格标题hover提示
         */
        renderHeader(h,title, content){
            return h('span', {}, [
                h('span', {style: 'font-weight: bold'}, title),
                h('el-popover', { props: { placement: 'top-start', width: '200', trigger: 'hover', content: content }}, [
                    h('i', { slot: 'reference', class:'el-icon-question', style: 'color:#666;margin-left: 6px'}, '')
                ])
            ]);
        },

        /**
         * 导出数据
         */
        handleExport() {
            let base = this.$baseUrl;
            let params = {...this.filterData};
            let ticket = localStorage.getItem('sessionTicket');
            let url = `${base}/student/shop_goods_activity_friday_sale%5Cexport_list?verify=${params.verify}&keyword=${params.keyword}&shop_title=${params.shop_title}&week=${params.week}&__ticket=${ticket}`;

            window.open(url);
        },

        /**
         * 显示历史活动弹窗
         * @param row
         */
        getHistoryList(row) {
            this.$post('/student/shop_goods_activity_friday_sale%5Cget_goods_join_history_list', {
                goods_no: row.goods_no,
                page_id: this.dialogPage.now_page
            }, resp => {
                if (resp.code === 1) {
                    this.historyDialog = true;
                    this.historyList = resp.data.list;
                    this.dialogPage = resp.data.page;
                } else {
                    this.$notify({
                        title: '提示',
                        type: 'warning',
                        message: resp.msg
                    });
                }
            });
        }
    }
};
</script>

<style lang="less" scoped>
.wrapper {
    width: 100%;

    .content-wrapper {
        display: flex;
        height: calc(100% - 24px);
        flex-direction: column;
        position: relative;
        margin: 12px;
        background: #fff;
        box-sizing: border-box;
        /*header*/
        .header {
            height: 68px;
            padding: 24px;
            box-sizing: border-box;
            box-shadow: 0px -1px 0px 0px #F0F2F5;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #F0F2F5;

            .header-title {
                color: #333333;
                font-size: 20px;
                height: 20px;
                font-weight: 500;
                position: relative;
                margin: 24px 0 24px 12px;

                &::before {
                    content: '';
                    position: absolute;
                    left: -12px;
                    top: 50%;
                    transform: translateY(-50%);
                    width: 3px;
                    height: 20px;
                    background: #1890FF;
                }
            }
        }

        /*筛选*/

        .filter-view {
            box-sizing: border-box;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            padding: 0 24px;
            margin: 24px 0 12px;

            .header-new-box {
                display: flex;
                align-items: center;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #333333;
                white-space: nowrap;
                margin-right: 24px;
                margin-bottom: 12px;

                &-title {
                    margin-right: 16px;
                    white-space: nowrap;
                }
                /deep/ .el-radio-button {
                    &.is-active {
                        .el-radio-button__inner {
                            background: #E6F1FC;
                            color: #20A0FF;
                            border-color: #20A0FF;
                        }
                    }
                }
            }
        }

        // 表格
        .table-wrapper {
            padding: 0 24px;
            flex: 1;
            height: 0;
        }

        .goods-info {
            display: flex;
            align-items: center;
            .goods-cover {
                width: 108px;
                height: 108px;
                cursor: pointer;
                margin-right: 16px;
                flex-shrink: 0;
            }
            .info {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #333333;
                .goods-info__title {
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #333333;
                    font-size: 14px;
                    cursor: pointer;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    overflow: hidden;
                    -webkit-line-clamp: 2;
                    margin-bottom: 8px;
                }
                .goods-info__no {
                    margin-bottom: 8px;
                }
            }
        }

        .status-wrapper {
            display: flex;
            align-items: center;
            justify-content: center;

            .status-dot {
                width: 6px;
                height: 6px;
                border-radius: 50%;
                margin-right: 5px;

                &.success {
                    background: #4CD964;
                }

                &.danger {
                    background: #FF3030;
                }

                &.warning {
                    background: #FFA72D;
                }

                &.normal {
                    background: #A6A6A6;
                }
            }
        }

        /* 排序 */
        .sort-wrap {
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            .sort-spliter {
                width: 1px;
                height: 12px;
                background: rgba(235, 235, 235, 1);
                margin: 0 10px;
            }
            .btn-sort {
                font-size: 14px;
                line-height: 1;
                color: #ccc;
                &:hover {
                    color: #20a0ff;
                }
            }
        }

        /* 分页 */

        .pagination-wrapper {
            padding: 12px 24px;
            .el-pagination {
                float: right;
                padding: 0;
                background-color: transparent;
            }
        }
    }
    /deep/ .el-dialog__header {
        padding-top: 10px;
        box-shadow:0 1px 0 0 rgba(233,233,233,1);
        display: flex;
        align-items: center;
        background: #FAFAFA;
        border-radius: 4px 4px 0 0;
        .el-dialog__title {
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }
        .el-icon-close:before {
            color: rgb(194,194,194);
            font-size: 17px;
            font-weight: bold;
        }
        .el-dialog__headerbtn {
            top: 14px;
        }
    }
    .dialog-footer {
        display: flex;
        justify-content: center;
    }
    /deep/ .el-textarea__inner {
        resize: none;
    }
    /deep/ .el-table__fixed-right {
        right: 6px!important;
    }
    .data-table {
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        // 操作按钮
        .option-btn-group {
            .el-button {
                margin-left: 0;
                margin-right: 10px;
            }
        }
    }
}
</style>

<style lang="less">
.friday-goods-verify-history-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
}
</style>
